<template>
  <div style="width: 100%;overflow: hidden">
    <div class="back" @click="toaddress">
      <i class="el-icon-close"></i>修改地址
    </div>
    <div style="margin: 20px;"></div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="联系人">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item label="">
        <el-radio-group v-model="form.sex">
          <el-radio label="先生"></el-radio>
          <el-radio label="女士"></el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="电   话">
        <el-input v-model="form.number"></el-input>
      </el-form-item>
      <el-form-item label="地   址">
        <el-input v-model="form.address"></el-input>
      </el-form-item>
      <el-form-item label="门牌号">
        <el-input v-model="form.door" ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit(form)" style="width: 90%;margin: auto;">确定</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
  export default {
    name: 'editaddress',
    data () {
      return {
        labelPosition: 'left',
        form: {
          name: this.$route.query.name,
          region: '',
          door: this.$route.query.door,
          flag: true,
          type: [],
          address: this.$route.query.address,
          number: this.$route.query.number,
          sex: this.$route.query.sex
        }
      }
    },
    // created () {
    //   this.from.sex = this.$route.query.sex
    // },
    methods: {
      toaddress () {
        this.$router.push('/address')
      },
      toDeals () {
        this.$router.push('/dealdetail')
      },
      onSubmit (form) {
        console.log(form)
        this.$store.dispatch('changeAddress', form)
        this.$router.push('/address')
      }
    }
  }
</script>
<style lang="stylus" type="text/stylus" scoped>
  @import '../../common/stylus/mixin.styl'
  .back
    width :100%
    height :40px
    background-color :blue
    line-height :40px
    color :white
    padding-left :10px
    font-size :14px
    i
      margin-right :20px
      font-size :18px

</style>
